/**
 * 轮播模块，添加，查看轮播列表，删除
 * 
 */
const express = require('express')
const { queryDBPromise } = require('../db/db')
const bannerRouter = express.Router() //路由对象


/**
 *  添加轮播图片
 *   method: post
 *    url: /banner
 *    参数: url, content
 */



/**
 * 轮番列表
 *   method: GET
 *   url: /banners
 */
bannerRouter.get('/banners',(req,res)=>{
    const sql = `SELECT id,url,content FROM banner`
    queryDBPromise(sql).then(data=>{
        res.send({
            code:1,
            list:data
        })
    })
})



/**
 * 删除轮播
 *   method: DELETE
 *   url: /banner/1
 */


module.exports = {bannerRouter}